/**
 * FileFind - ftp/shares indexing and search php engine
 * Module: persist-jpa20
 * Description: Persistence implementation with JPA 2.0
 * Copyright (c) 2003-2010 Rage Steel, www.gt2.ru
 */
package ru.ffind.persist.jpa20.model;

import static ru.ffind.persist.jpa20.model.QueryNames.FIND_FILES_BY_PARENT;

import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import ru.ffind.common.model.Filename;

/**
 * Filename implementation.
 *
 * FIXME Add flags
 * FIXME Add owner object
 *
 * @author Rage Steel
 */
@Entity(name = "Files")
@Table(name = "ff_files")
@NamedQueries({ 
	@NamedQuery(name = FIND_FILES_BY_PARENT ,
			query = "SELECT f FROM Files f WHERE f.parent = :parent") })
@AttributeOverrides({
	@AttributeOverride(name = "id",
			column = @Column(name = "file_id")),
	@AttributeOverride(name = "name", 
			column = @Column(name = "file_name")),
	@AttributeOverride(name = "datetime", 
			column = @Column(name = "file_datetime"))
})
@AssociationOverrides({
	@AssociationOverride(name = "parent",
			joinColumns = @JoinColumn(name = "dir_id"))
})
public class FileImpl extends EntryImpl 
		implements Filename {

	private static final long serialVersionUID = -7624647477487481556L;
	
	private Long fileSize;

    @Override
    @Column(name = "file_size")
    public long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

}
